﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;

namespace Freejobber.Core.Data
{
    public partial class db_freejobberEntities
    {
        public static db_freejobberEntities connection;
        public static db_freejobberEntities GetConnecton()
        {
            try
            {
                if (connection == null)
                {
                    if (Dns.GetHostName().Contains("azurewebsites"))
                    {
                        connection =
                            new db_freejobberEntities(
                                "metadata=res://*/Data.db_Freejobber.csdl|res://*/Data.db_Freejobber.ssdl|res://*/Data.db_Freejobber.msl;provider=System.Data.SqlClient;provider connection string=\"data source=f0he8jlgn0.database.windows.net,1433;initial catalog=db_Freejobber;user id=gelleor;password=Gbafujh1985;MultipleActiveResultSets=True;App=EntityFramework\"");
                    }
                    else
                        connection =
                            //new db_freejobberEntities( "metadata=res://*/Data.db_Freejobber.csdl|res://*/Data.db_Freejobber.ssdl|res://*/Data.db_Freejobber.msl;provider=System.Data.SqlClient;provider connection string=\"data source=orangebook\\sqlserver;initial catalog=db_Freejobber;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework\"");
                            new db_freejobberEntities( "metadata=res://*/Data.db_Freejobber.csdl|res://*/Data.db_Freejobber.ssdl|res://*/Data.db_Freejobber.msl;provider=System.Data.SqlClient;provider connection string=\"data source=ORANGEPC\\SQLSERVER;initial catalog=db_Freejobber;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework\"");
                }
            }
            catch (Exception ex)
            {
                return null;
            }

            return connection;
        }

    }
}
